Using Renderer Objects
A renderer is of typeTQ3RendererObject
, which is a type of shared object.
You create an instance of a renderer by callingQ3Renderer_New
orQ3Renderer_NewFromType
. Once you've created a new renderer, you need to associate it with a particular view, for example by callingQ3View_SetRenderer
.You've already seen (in the section "Creating a View," beginning on page 1-28) how to create a renderer object and attach it to a view object. As indicated previously, you can ensure that you take advantage of any available hardware accelerator by using the interactive renderer, as follows:
myRenderer = Q3Renderer_NewFromType(kQ3RendererTypeInteractive);To make the rendered images coherent, you should make the associated draw context double buffered (that is, you should set thedoubleBufferState
field of the draw context data structure to the valuekQ3True
). Some hardware rasterizer engines (such as the one supplied by Apple Computer, Inc.) can make coherent images without double buffering. This can provide a significant speed advantage, at the possible cost of some tearing. To take advantage
of such hardware, you keep the draw context double buffered (to indicate
that you want the images to be coherent) and call the function Q3InteractiveRenderer_SetDoubleBufferBypass, as follows:
Q3InteractiveRenderer_SetDoubleBufferBypass(myRenderer, kQ3True);In the unlikely event that you want to use a particular rasterizer with the interactive renderer, you can set a preference with the code:
Q3InteractiveRenderer_SetPreferences(myRenderer, vendor, engine);